<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {

    public function __construct(){
        parent::__construct();
        $user_id = session('user_id');
    }
    
    public function header(){
        header("Content-type: text/html; charset=utf-8");
        $user_id = session('id');
        $user = M('user')->where(array('user_id'=>$user_id))->find();
        $nav = M('nav')->where(array('is_show'=>1,'level'=>1))->select();
        foreach ($nav as $key => $val) {
            $nav[$key]['one'] = M('nav')->where(array('parent_id'=>$val['id']))->select();
        }
        // var_dump($nav);die;
        $this->nav = $nav;
        $this->user = $user;
    }

    public function index(){
        $this->header();
        $this->display();
    }
    public function index404(){

        $this->display();
    }
    public function blog(){
        $this->display();
    }
    public function blog_post(){
        $this->display();
    }
}